/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.ufba.lasid.v1.jitclouds.mda.datatypes.ft;

import br.ufba.lasid.v1.jitclouds.mda.utils.Shell;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author aliriosa
 */
public class ShellBasedFailoverDeployer extends BasicFailoverDeployer implements IFailoverDeployer{
        
    @Override
    public void execute(String action, IReplicable primary, IReplicable backup){
        String cmd = getCommand(action);
        String cmdShell = String.format(cmd, primary.getID(), backup.getID(), getPeriod().toString());
        try {
            Shell.execute(cmdShell);
        } catch (Exception ex) {
            Logger.getLogger(BasicFailoverDeployer.class.getName()).log(Level.SEVERE, null, ex);
        }
        
    }    
}
